home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1998 August / PC Plus SuperCD 50a Issue 142 (CD142a) (August 1998).iso / trial / demon / TURNPIKE.1 / CLASSES.ZIP / JAVA / IO / SequenceInputStream.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-04-14  |  1.2 KB  |  78 lines

  1. package java.io;
  2.  
  3. import java.util.Enumeration;
  4. import java.util.Vector;
  5.  
  6. public class SequenceInputStream extends InputStream {
  7.    // $FF: renamed from: e java.util.Enumeration
  8.    Enumeration field_0;
  9.    // $FF: renamed from: in java.io.InputStream
  10.    InputStream field_1;
  11.  
  12.    public SequenceInputStream(Enumeration var1) {
  13.       this.field_0 = var1;
  14.  
  15.       try {
  16.          this.nextStream();
  17.       } catch (IOException var2) {
  18.          throw new Error("panic");
  19.       }
  20.    }
  21.  
  22.    public SequenceInputStream(InputStream var1, InputStream var2) {
  23.       Vector var3 = new Vector(2);
  24.       var3.addElement(var1);
  25.       var3.addElement(var2);
  26.       this.field_0 = var3.elements();
  27.  
  28.       try {
  29.          this.nextStream();
  30.       } catch (IOException var4) {
  31.          throw new Error("panic");
  32.       }
  33.    }
  34.  
  35.    final void nextStream() throws IOException {
  36.       if (this.field_1 != null) {
  37.          this.field_1.close();
  38.       }
  39.  
  40.       this.field_1 = this.field_0.hasMoreElements() ? (InputStream)this.field_0.nextElement() : null;
  41.    }
  42.  
  43.    public int read() throws IOException {
  44.       if (this.field_1 == null) {
  45.          return -1;
  46.       } else {
  47.          int var1 = this.field_1.read();
  48.          if (var1 == -1) {
  49.             this.nextStream();
  50.             return this.read();
  51.          } else {
  52.             return var1;
  53.          }
  54.       }
  55.    }
  56.  
  57.    public int read(byte[] var1, int var2, int var3) throws IOException {
  58.       if (this.field_1 == null) {
  59.          return -1;
  60.       } else {
  61.          int var4 = this.field_1.read(var1, var2, var3);
  62.          if (var4 <= 0) {
  63.             this.nextStream();
  64.             return this.read(var1, var2, var3);
  65.          } else {
  66.             return var4;
  67.          }
  68.       }
  69.    }
  70.  
  71.    public void close() throws IOException {
  72.       do {
  73.          this.nextStream();
  74.       } while(this.field_1 != null);
  75.  
  76.    }
  77. }
  78.